package com.ayou.eggguard.farm.mapper;

import com.ayou.eggguard.farm.pojo.Caution;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface CautionMapper {
    List<Caution> getCautionList(LocalDateTime startTime,LocalDateTime endTime, String cautionType, String cautionStatus, String coopNumber);

    @Update("update caution set caution_status='已处理' where id=#{id}")
    void updateCautionStatus(Integer id);

    @Select("select caution.caution_type as name,count(*) as value from caution group by caution.caution_type")
    List<Map<String, Object>> getCautionTypeCount();

    @Select("select caution.coop_number as coopNumber,count(*) as count from caution group by caution.coop_number")
    List<Map<String, Object>> getCautionCount();
}
